package com.itheima.mall.api.ums;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.mall.mapper.ums.UmsAdminRoleRelationMapper;
import com.itheima.mall.pojo.ums.UmsAdminRoleRelation;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class UmsAdminRoleRelationServiceApiImpl implements UmsAdminRoleRelationServiceApi{
    @Autowired
    private UmsAdminRoleRelationMapper umsAdminRoleRelationMapper;

    /**
     * 根据adminId查找其对应的角色
     * @param adminId
     * @return
     */
    @Override
    public List<UmsAdminRoleRelation> getUserRole(Long adminId) {
        LambdaQueryWrapper<UmsAdminRoleRelation> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UmsAdminRoleRelation::getAdminId,adminId);
        List<UmsAdminRoleRelation> umsAdminRoleRelationList = umsAdminRoleRelationMapper.selectList(queryWrapper);
        return umsAdminRoleRelationList;
    }
}
